﻿using HBKY.Shop.Common;
using HBKY.Shop.Common.Attributes;
using HBKY.Shop.Common.PollyHelper;
using HBKY.Shop.Model.WebApiClients.Traffic.Fund;
using System.Net.Http;
using System.Threading.Tasks;

namespace HBKY.Shop.Service.Ext.WebApiClients.Traffic
{
    /// <summary>
    /// TrafficApi 后续统一走配置文件
    /// </summary>
    public class TrafficApiService: BaseApiService
    {
        private static readonly string _baseUrl = "https://traffic.niuguwang.com";
        public TrafficApiService(IHttpClientFactory httpClientFactory) : base(httpClientFactory)
        {
        }

        /// <summary>
        /// 行情页 时光组合
        /// </summary>
        /// <returns></returns>
        [Caching("FofFundList")]
        public virtual async Task<dynamic> GetFofFundList()
        {
            string url = "/v1/FofFund/List";
            return (await RequestApiProxy.Get<ResponseMessage<dynamic>>(_httpClient, $"{_baseUrl}{url}"))?.Data;
        }

        /// <summary>
        /// 发送消息
        /// </summary>
        public virtual async Task<dynamic> PostSmsMessage(dynamic input)
        {
            //?mobile={input.Mobile}&sendTime{input.SendTime}=&content={input.Content}
            string url = $"/sms/send";
            return await RequestApiProxy.Post<dynamic>(_httpClient,$"{_baseUrl}{url}", input);
        }
    }
}
